package com.smiier.skin.util;

import java.util.ArrayList;

import android.content.Context;
import cn.o.app.json.JsonUtil;
import cn.o.app.util.OUtil;

import com.smiier.skin.net.CostDoctorAppointTask.CostDoctorAppointItem;
import com.smiier.skin.net.CostPayTask.CostPayItem;
import com.smiier.skin.net.CostRechargeTask;
import com.smiier.skin.net.CostRechargeTask.CostRechargeItem;
import com.smiier.skin.net.SymptomPatientTask.SymptomItemInfo;
import com.smiier.skin.net.SysGetVerTask.SysVerList;
import com.smiier.skin.net.entity.Hospital;
import com.smiier.skin.net.entity.Hospital.HospitalItem;
import com.smiier.skin.net.entity.User;

public class GlobalSettings {

	/**
	 * 测试环境
	 */
	 public static final String SERVER_URL = "http://123.57.2.103/"; 
	 public static final String SERVER_URL_JOIN = "mf/handler.aspx"; 
	 public static final String SERVER_URL_TREATMENT = "http://182.92.236.217/"; 
	 public static final String SERVER_FIXED_JOIN = "configservice/mf/data/";
	 

	/*
	 * 线上环境
	 */
	/*public static final String SERVER_URL = "http://www.pifupro.com/";
	public static final String SERVER_URL_JOIN = "mf_test/handler.aspx";
	public static final String SERVER_FIXED_JOIN = "configservice_test/mf/data/";
	public static final String SERVER_URL_TREATMENT = "http://123.57.73.61/";*/
	
	

	public static final String SERVER_IMG_URL = SERVER_URL + "mfpic/";
	public static final int PAGE_SIZE = 10;
	public static String WEIXIN_APP_ID = "wx3e792110b182485c";
	public static String WEIXIN_APP_SECRET = "e7cde60a0875ec6c821bb82ffae5a7d0";

	// public static String QQ_APP_ID = "1101216096";

	public static String QQ_APP_ID = "1103472071";

	public static String WEIBO_APP_KEY = "641424196";
	// 患者端appid
	public static String WEIXIN_APP_ID_PATIENT = "wxe0cc84d95f443786";
	public static String WEIXIN_APP_SECRET_PATIENT = "81489ebf13c5e8e6f71c99e3dc9b911f";

	public static String QQ_APP_ID_PATIENT = "1104296099";

	public static String WEIBO_APP_KEY_PATIENT = "3864495587";

	public static String ALI_PAY_PARTNER = "2088411594176068";
	public static String ALI_PAY_SELLER = "pifuyisheng@qq.com";
	public static String ALI_PAY_PRIVATE_KEY = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAP7Gq5UJJoNQuuRgLIECVt8JGpbc8D70m1KD3mGfeg0lB4b3U7apVd8Qu+Z1Z+rMz6T4+dPdR/oujfbNUhyJZM+3NAavv1/HPkJcE2OK5Kwf/WldPm7mDT2XWPGfU+oSVDtg4l0WizJ/kc92SK3Fnhh8NQZedzL9g6SJLXqRpR65AgMBAAECgYEAj6XGYl5pZ4qiBVewYADIqDJC2qKxll1mIc0WGmbHcxfYuaFDgu7Q6tdNii/SKpHV1YdHnMvb5FRRWMEFNe/FdTQyJguBjHyIw5u4pX549/ttQoFtD7vpFMxHs11rcAY9CWooUsFazDpFa4uwHGB46qvv+EGuDTIl0F0UpEl8Bu0CQQD/rf/+I/wiBfVi0M3DBcz2olHRrcjN2JhwA4qj364NdD7+D2XGvzPEpBqcZ7JqjLPnDfXAKiBKTbeyZp9vT4KvAkEA/xhhZhYuzeLXdoEhY1Aiz8fkJ53N3Kx/CimyBQQkSR+IYzpMl4M9NQ82RGMFkE7tXzaDYnmPJ6o3csbRnTHvFwJAXV+wQ6HkrJA8g2/6FSUDK3cwJkEvOm3FjfLdKOfBasxvTN1Wr/SX9VJxHXmJYPwtn04r15gK3tfvJEnyI/aHpQJATakufdXjCes1jW5iq8mJz5gbbbQtKDGbu4xWFhDcuyZOb2cgSkA6Mh0feFJtLzHYMlR2S1SWsIyxtM+yoRjCoQJBAIlCuqlOgakOlT6DWKZXakMFm1qZy5zRecXOoK6xcrjrNLf+dMj9o8Qf4Dj4PoxDUwSaEK0bVMrpdi76K+Z6twk=";
	public static String ALI_PAY_NOTIFY_URL = SERVER_URL + "mf/notify_url.aspx";

	public static final int REQUEST_CODE_PICK_CONTACT = 1;// 选择通讯录
	public static final int REQUEST_CODE_TAKE_PHOTO = 2;// 拍照
	public static final int REQUEST_CODE_PICK_PHOTO = 3;// 选择图片
	public static final int REQUEST_CODE_CROP_PHOTO = 4;// 剪裁图片

	public static boolean mIsLoginActivity = false;
	/**
	 * 好药师逻辑
	 */

	public static String secretKey = "m$f#7d@ka83c%9y5l"; // 好药师正式环境
	public static final String SERVER_URL_HAOYAOSHI = "http://m.ehaoyao.com:8081/webrGoodsList.do?method=register";
	public static String orderInterface = "goodsSeekDetails"; // 入口
	/**
	 * 好药师正式环境
	 */
	// String secretKey = "4090a69724"; // 好药师测试环境
	// String SERVER_URL_HAOYAOSHI =
	// "http:// api.ehaoyao.com /webrGoodsList.do?method=register";

	public static boolean isDoctor;

	public static boolean isBangding = false;

	public static final String PLATFORM_ANDROID = "Android";

	public static final int FOLLOW_TYPE_USER = 1;
	public static final int FOLLOW_TYPE_QUESTION = 2;

	public static final String FOLLOW_METHOD_ADD = "add";
	public static final String FOLLOW_METHOD_CANCEL = "cancel";

	public static final String IMG_SRC = "_src.jpg";
	public static final String IMG_THUMB = "_th.jpg";

	public static final String PAY_PLATFORM_WEIXIN = "mf_weixin";
	public static final String PAY_PLATFORM_ALI = "ali";

	public static final String THIRD_TYPE_QQ = "qq";
	public static final String THIRD_TYPE_SINA = "sina";
	public static final String THIRD_TYPE_WEIXIN = "weixin";
	public static String mPwd;
	public static final int IS_FALSE = 0;
	public static final int IS_TRUE = 1;

	public static final int CONFIRM_CODE_TYPE_REGISTER = 0;
	public static final int CONFIRM_CODE_TYPE_PWD = 1;
	public static final int CONFIRM_CODE_TYPE_TRADE_PWD = 2;
	public static final int CONFIRM_CODE_TYPE_BIND_PHONE = 3;

	public static final int LOGIN_TYPE_UNKNOWN = 0;
	public static final int LOGIN_TYPE_USERNAME = 1;
	public static final int LOGIN_TYPE_THIRD = 2;

	public static int login_type;

	private static final String PREFS_FILENAME = "GlobalPrefsFile";
	private static final String SYMPTOM_FILENAME = "SymptomFile";
	private static final String PREFS_MESSAGE = "MessageData";

	// 用于登录的属性
	private static final String PREFS_LOGIN_TYPE = "loginType";
	private static final String PREFS_USER_NAME = "userName";
	private static final String PREFS_USER_PWD = "pwd";
	private static final String LOGING_FIRST = "firstLoginThreed";
	private static final String PREFS_LOGIN_THRID_TYPE = "thirdType";
	private static final String PREFS_LOGIN_THRID_ID = "thirdId";

	private static final String PREFS_SHARE_GUIDE = "shareGuide";

	private static final String PREFS_MESSAGE_GUIDE = "messageRember";

	private static final String PREFS_SYS_VER = "sysVer";
	private static final String PREFS_SYMPTOM_VER = "symptomVer";
	public static ArrayList<CostRechargeItem> mCostRecharge = new ArrayList<CostRechargeTask.CostRechargeItem>();
	public static ArrayList<CostPayItem> mCostPay = new ArrayList<CostPayItem>();
	public static ArrayList<CostDoctorAppointItem> mDoctorAppoints;
	// 全局变量存储
	public static String sToken;// Token
	public static long sUid;// 用户编号
	public static User sUser;// 登陆用户信息
	public static User sBingLi;// 病例
	public static Double sYue;// 余额
	public static Hospital mHospital;
	public static SymptomItemInfo symptomItemInfo;
	public static ArrayList<HospitalItem> mHospitalItems = new ArrayList<Hospital.HospitalItem>();
	public static boolean sApp4Doctor = false;// 医生端

	public static boolean appStart = false;

	public static String getSex(int sex) {
		if (sex == User.SEX_MALE) {
			return "男";
		} else if (sex == User.SEX_FEMALE) {
			return "女";
		} else {
			return null;
		}
	}

	public static Class<?> getActivity4Navigate(Context context) {
		try {
			return Class.forName(OUtil.getAppPackage(context)
					+ ".NavigateActivity");
		} catch (Exception e) {
			return null;
		}
	}

	public static SysVerList getSysVerList(Context context) {
		String jsonStr = OUtil.getPrefString(context, PREFS_FILENAME,
				PREFS_SYS_VER, null);
		SysVerList list = null;
		try {
			list = JsonUtil.convert(jsonStr, SysVerList.class);
		} catch (Exception e) {

		}
		return list;
	}

	/*
	 * public static ArrayList<SymptomPatientItem> getSymptomData(Context
	 * context){
	 * 
	 * String jsonStr = OUtil.getPrefString(context, SYMPTOM_FILENAME,
	 * PREFS_SYMPTOM_VER, null);
	 * 
	 * ArrayList<SymptomPatientItem> data = null;
	 * 
	 * try { data = JsonUtil.convert(jsonStr, SymptomPatientData.class);
	 * 
	 * 
	 * } catch (Exception e) { // TODO Auto-generated catch block
	 * e.printStackTrace(); }
	 * 
	 * return data; }
	 * 
	 * f7fdd5ddf565c97ca8c8d262bc58358c
	 */

	public static void setSysVerList(Context context, SysVerList value) {
		try {
			OUtil.setPrefString(context, PREFS_FILENAME, PREFS_SYS_VER,
					JsonUtil.convert(value));
		} catch (Exception e) {

		}
	}

	public static boolean getShareGuide(Context context) {
		return OUtil.getPrefBoolean(context, PREFS_FILENAME, PREFS_SHARE_GUIDE,
				false);
	}

	public static void setShareGuide(Context context, boolean value) {
		OUtil.setPrefBoolean(context, PREFS_FILENAME, PREFS_SHARE_GUIDE, value);
	}

	public static void setMessageData(Context context, String string) {
		OUtil.setPrefString(context, PREFS_MESSAGE, PREFS_MESSAGE_GUIDE, string);
	}

	public static String getShareMessage(Context context) {
		return OUtil.getPrefString(context, PREFS_MESSAGE, PREFS_MESSAGE_GUIDE,
				null);
	}

	public static int getLoginType(Context context) {
		return OUtil.getPrefInt(context, PREFS_FILENAME, PREFS_LOGIN_TYPE,
				LOGIN_TYPE_UNKNOWN);
	}

	public static void setLoginType(Context context, int value) {
		OUtil.setPrefInt(context, PREFS_FILENAME, PREFS_LOGIN_TYPE, value);
	}

	public static String getLoginUserName(Context context) {
		return OUtil
				.getPrefString(context, PREFS_FILENAME, PREFS_USER_NAME, "");
	}

	public static void setLoginUserName(Context context, String value) {
		OUtil.setPrefString(context, PREFS_FILENAME, PREFS_USER_NAME, value);
	}

	public static String getLoginUserPwd(Context context) {
		return OUtil.getPrefString(context, PREFS_FILENAME, PREFS_USER_PWD, "");
	}

	public static void setLoginUserPwd(Context context, String value) {
		OUtil.setPrefString(context, PREFS_FILENAME, PREFS_USER_PWD, value);
	}

	public static boolean getLoginFrist(Context context) {
		return OUtil.getPrefBoolean(context, PREFS_FILENAME, LOGING_FIRST,
				false);
	}

	public static void setLoginFrisr(Context context, boolean b) {
		OUtil.setPrefBoolean(context, PREFS_FILENAME, LOGING_FIRST, b);
	}

	public static String getLoginThirdType(Context context) {
		return OUtil.getPrefString(context, PREFS_FILENAME,
				PREFS_LOGIN_THRID_TYPE, "");
	}

	public static void setLoginThirdType(Context context, String value) {
		OUtil.setPrefString(context, PREFS_FILENAME, PREFS_LOGIN_THRID_TYPE,
				value);
	}

	public static String getLoginThirdId(Context context) {
		return OUtil.getPrefString(context, PREFS_FILENAME,
				PREFS_LOGIN_THRID_ID, "");
	}

	public static void setLoginThirdId(Context context, String value) {
		OUtil.setPrefString(context, PREFS_FILENAME, PREFS_LOGIN_THRID_ID,
				value);
	}
}
